
from PySide.QtCore import QDateTime

from core.base import *
from core.customer import *

class TransactionModel(BaseModel):
	def __init__(self):
		self.stocks = []
		self.sale_time = QDateTime.currentDateTime()
		self.customer = CustomerModel()
		self.last_modified = None
		self.delivery_status = 'DELIVERED'
		self.paid = True

	def get_stocks(self):
		return self.stocks

	def get_sale_time(self):
		return self.sale_time

	def get_customer(self):
		return self.customer

	def set_customer(self, customer):
		self.customer = customer

	def get_last_modification_time(self):
		return self.last_modified

	def update_last_modification_time(self):
		self.last_modified = QDateTime.currentDateTime()

	def get_delivery_status(self):
		return self.delivery_status

	def set_delivery_status(self, status):
		self.delivery_status = status

	def is_paid(self):
		return self.paid

	def set_paid(self, paid):
		self.paid = paid


class TransactionController(BaseController):
	def get_all(self):
		transactions = []

		for i in range(0, 5):
			transactions.append(TransactionModel())

		print 'Updating TransactionView...'
		self.update_views(transactions)
		return transactions

	def get_all_from(self, customer):
		return []

	def get_all_undelivered(self):
		return []

	def get_all_unpaid(self):
		return []

